﻿#region NeoPatterns
// 
// NeoPatterns framework is released under LGPLv3 license.
// See http://www.opensource.org/licenses/lgpl-3.0.html for more details.
// 
// Please visit http://neopatterns.wikidot.com for more information about NeoPatterns
// 
// Copyright (c) Pascal Craponne 2008
// 
#endregion

using System;
using System.Collections.Generic;
using System.Reflection;

namespace NeoPatterns.Patterns.UniformAccessor
{
    /// <summary>
    /// Allows to access all members from a given type for a given type
    /// </summary>
    public interface IUniformAccessor
    {
        /// <summary>
        /// Enumerates all members with a given type for a given object
        /// </summary>
        /// <typeparam name="TMember"></typeparam>
        /// <param name="holder"></param>
        /// <returns></returns>
        IEnumerable<KeyValuePair<MemberRef, TMember>> Enumerate<TMember>(object holder);

        /// <summary>
        /// Registers a non-generic collection (which can not be automatically identified)
        /// </summary>
        /// <param name="memberType"></param>
        /// <param name="memberInfo"></param>
        void RegisterMemberCollection(Type memberType, MemberInfo memberInfo);

        /// <summary>
        /// Registers a collection type, to be automatically identified and handled
        /// </summary>
        /// <param name="memberType"></param>
        /// <param name="arrayAdapterType"></param>
        void RegisterSpecializedCollection(Type memberType, Type arrayAdapterType);
    }
}
